#include<bits/stdc++.h>
using namespace std;
int n,m,a[100001],p[100001],q,x,y;	
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);	
	}
	for(int i=1;i<=m;i++){
		scanf("%d",&q);
		if(q==1){
			scanf("%d%d",&x,&y);
			a[x]=y;
		}
		if(q==2){
			int ans=0;
			scanf("%d",&x);
			for(int j=1;j<=n;j++){
				if(j!=x&&a[j]<a[x]&&a[i]<a[j]+1){
					ans++;
				}
			}
			printf("%d\n",ans+1);
		}
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
